<?php 
$manu_id = 0;
$dictbts_id = 0;
$manufacturers = array();
$dictbts = array();
$manufacturers = DictManufacturer::model()->findAll();
$ops_manufacturers = array();
$ops_dictbts = array();
if(empty($manufacturers)){
	echo "<script>alert('没有可选制造商,请先创建');window.location.replace('index.php?r=dictManufacturer/admin');</script>";
}else{	
	$ops_manufacturers = CHtml::listData($manufacturers,'RECORD_ID','MANNAME_V');
	$ops_manufacturers[0] = "请选择制造商";	
	$ops_dictbts[0] = "请选择电池规格";	
}

?>


<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'bt-batterys-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array(
		'class' => 'form collapsed bt_batterys',
	),
)); ?>
<fieldset  >
	<legend><?php echo Controller::getActionName($this->action->id); ?></legend>


 
	<div class="notification tip" style="display: block; "> 
    <span class="strong">Tip:</span> <?php echo $form->errorSummary($model); ?>
    
 <span class="close" title="Dismiss"></span>

    </div>
<table border="1" cellpadding="2" cellspacing="10">	
	

    <div class = "row">
    <label>
	<tr>
	<td>
		<?php echo $form->labelEx($basetypemodel,'所属站点'); ?>
	</td>
	<td>
		<select name="MtsysBase[BASE_ID]"> 
		<?php foreach($base as $b){?>
		<option <?php echo ($model->BASE_N == $b->BASE_ID)?'selected="selected"':'';?>value="<?php echo $b->BASE_ID;?>"><?php echo $b->BASE_NAME;?>
	    <?php } ?>
		</option>		
		</select>
		
		</td>
		</tr>
	</label>
</div> 
    
    


    <div id="row">
    <label>
	<tr>
	<td>
		<?php echo $form->labelEx($manumodel,'MANNAME_V'); ?>
	</td>
	<td>
<?php
/*echo CHtml::dropDownList('DictManufacturer[RECORD_ID]',$manu_id, $ops_manufacturers ,array(
	'ajax' => array(
		'type'=>'POST',
		'url'=> array('/btBattery/getDictbatterys'),
		'update'=>'#DICTBATTERY_ID',
		'data'=>array('RECORD_ID'=>'js:$("#RECORD_ID").val()'),
	),
	'id'=>'RECORD_ID',			
));*/
echo CHtml::dropDownList('DictManufacturer[RECORD_ID]',$manu_id, $ops_manufacturers ,array(
		'ajax' => array(
				'type'=>'POST',
				'url'=> array('/btBattery/getDictbatterys'),
				'update'=>'#DICTBATTERY_ID',
				'data'=>array('RECORD_ID'=>'js:$("#RECORD_ID").val()'),
		),
		'id'=>'RECORD_ID',
));
/*echo CHtml::dropDownList('DictBattery[RECORD_ID]',$dictbts_id, $ops_dictbts, array(
		'id'=>'DICTBATTERY_ID',
));*/
/*
echo CHtml::dropDownList('BATTERYTYPE_V',$manu_id, $ops_manufacturers ,array(
		'ajax' => array(
				'type'=>'POST',
				'url'=> array('/btBattery/getDictbatterys'),
				'update'=>'#DICTBATTERY_ID',
				'data'=>array('BATTERYTYPE_V'=>'js:$("#BATTERYTYPE_V").val()'),
		),
		'id'=>'BATTERYTYPE_V',
));
echo CHtml::dropDownList('DICTBATTERY_ID',$dictbts_id, $dictbts, array(
	'id'=>'DICTBATTERY_ID',
));*/
?>
		</td>
		</tr>
	</label>
</div>    
    
    <div id="row">
    <label>
	<tr>
	<td>
		<?php echo $form->labelEx($bttypemodel,'BATTERYTYPE_V'); ?>
	</td>
	<td>
<?php
/*echo CHtml::dropDownList('DictManufacturer[RECORD_ID]',$manu_id, $ops_manufacturers ,array(
	'ajax' => array(
		'type'=>'POST',
		'url'=> array('/btBattery/getDictbatterys'),
		'update'=>'#DICTBATTERY_ID',
		'data'=>array('RECORD_ID'=>'js:$("#RECORD_ID").val()'),
	),
	'id'=>'RECORD_ID',			
));*/
/*echo CHtml::dropDownList('DictManufacturer[RECORD_ID]',$manu_id, $ops_manufacturers ,array(
		'ajax' => array(
				'type'=>'POST',
				'url'=> array('/btBattery/getDictbatterys'),
				'update'=>'#DICTBATTERY_ID',
				'data'=>array('RECORD_ID'=>'js:$("#RECORD_ID").val()'),
		),
		'id'=>'RECORD_ID',
));*/
echo CHtml::dropDownList('DictBattery[RECORD_ID]',$dictbts_id, $ops_dictbts, array(
		'id'=>'DICTBATTERY_ID',
));




/*
echo CHtml::dropDownList('BATTERYTYPE_V',$manu_id, $ops_manufacturers ,array(
		'ajax' => array(
				'type'=>'POST',
				'url'=> array('/btBattery/getDictbatterys'),
				'update'=>'#DICTBATTERY_ID',
				'data'=>array('BATTERYTYPE_V'=>'js:$("#BATTERYTYPE_V").val()'),
		),
		'id'=>'BATTERYTYPE_V',
));
echo CHtml::dropDownList('DICTBATTERY_ID',$dictbts_id, $dictbts, array(
	'id'=>'DICTBATTERY_ID',
));*/
?>
		</td>
		</tr>
	</label>
</div>

	<div class = "row">

<label>
<tr>
<td>
		<?php echo $form->labelEx($model,'BASE_TYPE'); ?>
		</td>
<td>
<?php 
//echo CHtml::dropDownList('MysysBasetype[RECORD_ID]',0, $basetypes, array(
		//'id'=>'MBTYPE_ID',
//));
?>
<?php echo CHtml::dropDownList('MysysBasetype[RECORD_ID]','', CHtml::listData($basetypes, 'RECORD_ID', 'BASE_TYPE'));
?>
		</td>
</tr>
	</label>
    </div>


 	<div class = "row">
    	<label>
    	 <tr>
 <td>
		<?php echo ($form->labelEx($model,'RECORD_ID')) . '(请填写xxxxxx-x例111111-1，8位标准编码)'; ?>
		</td>
<td>
		<?php echo $form->textField($model,'RECORD_ID'); ?>
		</td>
</tr>
		<?php //echo $form->error($model,'BASE_N'); ?>
	</label>
    </div>
    
	<div class = "row">
 
 <label>
  <tr>
 <td>
		<?php echo $form->labelEx($model,'GROUPNAME_V'); ?>
		</td>
<td>
		<?php echo $form->textField($model,'GROUPNAME_V',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'GROUP_V'); ?>
		</td>
</tr>
	</label>
    </div>   
	<div class = "row">
	<label>
	  <tr>
		<td>
		<?php // echo $form->labelEx($bttypemodel,'BATTERYTYPE_V'); ?>
		</td>
		<td>
		<?php // echo CHtml::dropDownList('DictBattery[RECORD_ID]','', CHtml::listData($btType, 'RECORD_ID', 'BATTERYTYPE_V'));
		?>
		</td>
		</tr>
	</label>
    </div>
   
	<div class = "row">
	<label>
	 <tr>
 <td>
		<?php  echo $form->labelEx($model,'BATTERYNUM_N'); ?>
		</td>
<td>
		<?php  echo $form->textField($model,'BATTERYNUM_N'); ?>
		</td>
</tr>
		<?php //echo $form->error($model,'BATTERYNUM_N'); ?>
	</label>



    </div>

	<div class = "row">

	<label>
		 <tr>
 <td>
		<?php //echo $form->labelEx($model,'CREATE_USERID'); ?>
		<?php //echo $form->textField($model,'CREATE_USERID'); ?>
		<?php //echo $form->error($model,'CREATE_USERID'); ?>
	</label>
    </div>

	<div class = "row">
	<label>
			 <tr>
 <td>
		<?php //echo $form->labelEx($model,'INSTALL_TIME'); ?>
				</td>
<td>
		<?php //echo $form->textField($model,'SETUP_D'); ?>
		<?php //echo $form->error($model,'SETUP_D'); ?>
		
		<?php
		/*	$this->widget('zii.widgets.jui.CJuiDatePicker', array(
			'model'=>$model,
			'attribute'=>'INSTALL_TIME',
			    'options'=>array(
			        'showAnim'=>'fold',
					'dateFormat'=>'yy-mm-dd'
			    ),
			    'htmlOptions'=>array(
			        'style'=>'height:26px;'
			    ),
			));*/
		?>
				</td>
</tr>
	</label>
    </div>
    
	<div class = "row">
	<label>
			 <tr>
 <td>
		<?php echo $form->labelEx($model,'SETUP_D'); ?>
		<?php //echo $form->textField($model,'SETUP_D'); ?>
		<?php //echo $form->error($model,'SETUP_D'); ?>
						</td>
<td>
		<?php
			$this->widget('zii.widgets.jui.CJuiDatePicker', array(
			'model'=>$model,
			'attribute'=>'SETUP_D',
			    'options'=>array(
			        'showAnim'=>'fold',
					'dateFormat'=>'yy-mm-dd'
			    ),
			    'htmlOptions'=>array(
			        'style'=>'height:26px;'
			    ),
				'language'=>'ZH-CN'
			));
		?>
						</td>
</tr>
	</label>
    </div>
    
	<div class = "row">
	<label>
		 <tr>
 <td>
		<?php echo $form->labelEx($model,'DEVICE_V'); ?>
				</td>
<td>
		<?php echo $form->textField($model,'DEVICE_V',array('size'=>10,'maxlength'=>10)); ?>
		<?php //echo $form->error($model,'CURVAL_N'); ?>
				</td>
</tr>
	</label>
    </div>

	<div class = "row">
	<label>
	 <tr>
 <td>
		<?php echo $form->labelEx($model,'IP_V'); ?>
		</td>
<td>
		<?php echo $form->textField($model,'IP_V',array('size'=>10,'maxlength'=>10)); ?>
		</td>
</tr>
		<?php //echo $form->error($model,'IP_V'); ?>
	</label>
    </div>

	<div class = "row">

	<label>
		 <tr>
 <td>
		<?php echo $form->labelEx($model,'PORT_N'); ?>
				</td>
<td>
		<?php echo $form->textField($model,'PORT_N',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'CUR_ELECTRIC_N'); ?>
				</td>
</tr>
	</label>
    </div>



	<div class = "row">
	<label>
	 <tr>
 <td>
		<?php echo $form->labelEx($model,'ADDR_N'); ?>
		</td>
<td>
		<?php echo $form->textField($model,'ADDR_N',array('size'=>10,'maxlength'=>10)); ?>
		<?php //echo $form->error($model,'CUR_HL_INNER_N'); ?>
		</td>
</tr>
	</label>

    </div>

	<div class = "row">
	<label>
		 <tr>
 <td>
		<?php echo $form->labelEx($model,'SETUPADDR_V'); ?>
				</td>
<td>
		<?php echo $form->textField($model,'SETUPADDR_V',array('size'=>10,'maxlength'=>10)); ?>
		<?php //echo $form->error($model,'FORCASTVOLUME_N'); ?>
				</td>
</tr>
	</label>
    </div>

	<div class = "row">
	<label>
			 <tr>
 <td>
		<?php echo $form->labelEx($model,'REMARK_V'); ?>
						</td>
<td>
		<?php echo $form->textField($model,'REMARK_V',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'REMARK_V'); ?>
						</td>
</tr>
	</label>
    </div>
 </table>
 <?php echo "<br>" ?>
	<div class = "row">
	<?php echo CHtml::submitButton($model->isNewRecord ? '添加' : '保存',array('class'=>'button blue')); ?>
</fieldset>
<?php $this->endWidget(); ?>

